<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <meta name="csrf-token" content="{{ csrf_token() }}">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">	
        <link rel="shortcut icon" type="image/x-icon" href="{{URL::asset('handan/images/logo-icon.png')}}" />
        <title>{{$_GET['name']}}</title>
        <link rel="stylesheet" href="{{URL::asset('mobile/css/public.css') }}"/>
        <link rel="stylesheet" href="{{URL::asset('mobile/css/hangqing.css') }}"/>
		<script>
			var j_top     = "{{ URL::asset('mobile/image/top.png') }}",  //上箭头
				j_down    = "{{ URL::asset('mobile/image/down.png') }}", // 下箭头
				starttime = '{{$starttime}}',    //开始策略时间
				endtime   = '{{$endtime}}',      //结束策略时间
				nowtime   = Date.parse(new Date()), // 定时任务
				timer     = 0,         //定时器
				timer1    = 0,         //图表定时器
				alltype   = '{{$alltype}}',   //策略页面持仓和进入的品种 
				gourl = "{{ url('/closeOut') }}",  //平仓接口
				pingcangType = 0,     //平仓执行开关
				updateurl = "{{ url('/updateorder') }}",   //修改止盈止损的接口
				J_hold = "{{ url('/checkordernum') }}",    //策略路径/
				J_login = "{{ url('/mlogin') }}",    //进入登录页
				gowanshan = "{{url('/baseinfo?id=info')}}",  //完善资料路径页面
				typename = '',     //品种类别
				type = '',         //品种类别
				posturl = "{{ url('/gotoHandan') }}",   //策略接口
				issession = '{{session("eai")["id"]}}',  //判断浏览器有没有session
				callorder = "{{ url('/callorder') }}",   //策略协议
				chicang = "{{ url('/chicang') }}";
		</script>
		<script src="{{URL::asset('mobile/js/public.js') }}"></script>
		<script src="{{URL::asset('public_js/jquery-3.2.1.min.js')}}"></script>
		<script src="{{ URL::asset('public_js/src/echarts.js') }}"></script>
		<script src="{{URL::asset('mobile/js/hangqing.js') }}"></script>
		{{--<script type="text/javascript" src="http://cdn.webfont.youziku.com/wwwroot/js/wf/youziku.api.min.js"></script>
		<script type="text/javascript">
		$youziku.load(".font", "e842666c895c4ced9a8572f5c5960be3", "PingFangSC_R");
		  $youziku.load(".font_one", "3457a57b538e4214b883cfa3e984c251", "PingFangSCM");
		$youziku.draw();
		</script>--}}
    </head>
<body>
	<!-- 头部 -->
	 @if (session('eai'))
	<header id="header">
		<div><img src="{{session('eai')['photo']}}"/><span>{{ session('eai')['username'] }}</span></div>
		<div>总收益：<span>{{ round($sumfinal,2) }}</span></div>
	</header>
	@endif
	<!-- 正在持仓 -->
	<div class="chicang">
		<div>当前持仓</div>
		<div><span>{{ $return['count']}}</span>/3</div>
	</div>
	 <!--导航 -->
	<nav>
		<div>
			<span>今日开</span>
			<span>昨日收</span>
			<span>最高</span>
			<span>最低</span>
		</div>
		<div id="LastOpen">
			<span class="font">1263.22</span>
			<span class="font">1263.22</span>
			<span class="font">1263.22</span>
			<span class="font">1263.22</span>
		</div>
	</nav>
	<!-- 买入卖出 -->
	<div class="single">
		<div>
			<span class="gray font_one" id="saleNum"><input type="hidden" id="sell" value=""/>1263.22<img src="{{ URL::asset('mobile/image/top.png') }}"/></span>
			<span>买入价</span>
			<span id="Purchase" >买入</span>
		</div>
		<div>
			<span class="green font_one" id="buyNum"><input type="hidden" id="buy" value=""/>1263.22<img src="{{ URL::asset('mobile/image/top.png') }}"/></span>
			<span>卖出价</span>
			<span id="SellOut">卖出</span>
		</div>
	</div>
	<!-- 我的策略 -->
	{{--@if($return['status'] == 1)
		<section>
			<div>
				<div>我的策略</div>
				<div>浮动点位：<span class="pointNum">
				<!-- 浮动点数begin  -->
				<script>
					fudot();
					setInterval(fudot,300);
					function fudot(){    //我的策略 -》 浮动点数
						var i=0;
						@foreach ($return['data'] as $val)
							var data = $("input[name=oldpot_FX{{ $val->typename }}]").val();
							i = (parseFloat(i) + parseFloat(data)).toFixed(5);
						@endforeach
						$('.pointNum').html(parseFloat(i));
					}
				</script>
				<!-- 浮动点数end  -->
				</span></div>
			</div>
			<ul>
			@foreach ($return['data'] as $val)
				<li class="orderTab">
					<div>
						<span>{{ $val->chinaname }} <span>{{ $val->typename }}</span></span>
						<span>{{ $val->buy_status }}</span>
						<span id="last_FX{{ $val->typename }}">
						<input type='hidden' name='oldpot_FX{{ $val->typename }}' />
						<script>
								profile_loss('{{ $val->buy_status }}','{{ $val->typename }}','{{ $val->begin_point }}');
								setInterval(function(){
									profile_loss('{{ $val->buy_status }}','{{ $val->typename }}','{{ $val->begin_point }}');
								},300);
								//我的策略 -》 盈亏点位
								function profile_loss(buy_status,typename,begin_point) {
									if (buy_status == '买入') {    // 拿到当前实时变化的价格
										var price = $('input[name=buyFX'+typename+']').val();
									} else {
										var price = $('input[name=sellFX'+typename+']').val();
									}
									if(buy_status == '卖出'){
										if (typename == 'XAUUSD') {
											// var lastprice = MyCallList(begin_point,price,1,10,2);
											var lastprice = (( parseFloat(begin_point)-parseFloat(price)-parseFloat(1))*10).toFixed(2);
										} else if (typename == 'NYOL20'){
											// var lastprice = MyCallList(begin_point,price,0.1,100,2);
											var lastprice = (( parseFloat(begin_point)-parseFloat(price)-parseFloat(0.1))*100).toFixed(2);
										}else if( typename.indexOf('JPY')>0){
											// MyCallList(begin_point,price,0.1,100,3)
											var lastprice = (( parseFloat(begin_point)-parseFloat(price)-parseFloat(0.1))*100).toFixed(3);
										}else{
											var lastprice = (( parseFloat(begin_point)-parseFloat(price)-parseFloat(0.001))*10000).toFixed(5);
										}
									}else{
										if (typename == 'XAUUSD') {
											var lastprice = ((parseFloat(price) - parseFloat(begin_point)-parseFloat(1))* 10).toFixed(2) ;
										} else if (typename == 'NYOL20'){
											var lastprice = ((parseFloat(price) - parseFloat(begin_point)-parseFloat(0.1))* 100).toFixed(2);
										}else if( typename.indexOf('JPY')>0){
											var lastprice = ((parseFloat(price) - parseFloat(begin_point)-parseFloat(0.1))* 100).toFixed(3);
										}else{
											var lastprice = ((parseFloat(price) - parseFloat(begin_point)-parseFloat(0.001))* 10000).toFixed(5);
										}
									}

									var oldprice = $("input[name=oldpot_FX"+typename+"]").val();
									if(oldprice != ''){
										var newpotprice = parseFloat(lastprice) - parseFloat(oldprice);
										if(newpotprice > 0){
											$("#last_FX"+typename).css({'color':'#f7512b'});
										}else if(newpotprice < 0){
											$("#last_FX"+typename).css({'color':'#27a885'});
										}
									}else{
										$("#last_FX"+typename).css({'color':'#8c8c8c'});
									}
									$("#last_FX"+typename).html('<input type="hidden" name=oldpot_FX'+typename+' />'+parseFloat(lastprice));
									$("input[name=oldpot_FX"+typename+"]").val(parseFloat(lastprice));
								}
						</script>
						</span>
					</div>
					<div>
						<p>当&nbsp;前&nbsp;价&nbsp;：<span class="red" id="FX{{ $val->typename }}">{{ $val->begin_point }}</span>
							<input  type='hidden' name='curr_FX{{ $val->typename }}'>
							<script>
								var golow = "{{ URL::asset('handan/images/golow.png') }}",
									goup = "{{ URL::asset('handan/images/goup.png') }}"
							    $(function(){
									current_price('{{ $val->buy_status }}','{{ $val->typename }}');
									setInterval(function(){
										current_price('{{ $val->buy_status }}','{{ $val->typename }}');
									},300);
								})
								
							</script>
						</p>
						
						<p>止 &nbsp; 盈：<span>{{ $val->target_profit_point }}</span></p>
					</div>
					<div>
						<p>开&nbsp;仓&nbsp;价&nbsp;：<span>{{ $val->begin_point }}</span></p>
						<p>止 &nbsp; 损：<span>{{ $val->target_loss_point }}</span></p>
					</div>
					<div>
						<p>开仓时间：<span>{{ $val->begin_time }}</span></p>
					</div>
					<div>
						<span>订单号：<span>{{ $val->tradeid }}</span></span>
						<span onclick="PingChang('{{ $val->tradeid }}','{{ $val->typename }}','{{ $val->buy_status }}')"><i></i>平仓</span>
						<span onclick="Modify({{ $val->profit_point }},{{ $val->loss_point }},'{{ $val->typename }}','{{ $val->tradeid }}','{{ $val->buy_status }}',{{ $val->begin_point }},{{ $val->target_profit_point }},{{ $val->target_loss_point }})"><i></i>修改</span>
					</div>
				</li>
			 @endforeach
			 </ul>
		</section>
	@endif
	<!-- 修改  -->
	<div class="modify" id="moDify">
		<div class="title">
			修改
		</div>
		<div class="content">
			<div>止盈：<input type="text" maxlength="3" id="profitPoint_"/ onkeyup="userInputProfit(1)"><span>止盈范围10-500</span></div>
			<div>止损：<input type="text" maxlength="2" id="lossPoint_"/ onkeyup="userInputProfit(2)"><span>止损范围10-100</span></div>
		</div>
		<div class="modify_bottom">
			<span onclick="goCancel()">取消</span>
			<span onclick="goUpdatePoint(this)">确定</span>
		</div>
	</div>
	<!-- 平仓确定操作 -->
	<div class="pingCAlert">
		<div>您确定要平仓吗？</div>
		<div class="modify_bottom">
			<span id="goCanel">取消</span>
			<span onclick="go_stop()">确定</span>
		</div>
	</div>
	--}}
	<!-- 图标  -->
	<div class="j_echarts">
		<a href="{{ url('/echarts') }}?typename={{$typename}}">查看图表</a>
	</div>
	<!-- 新增策略 -->
	<div class="CallSingle">
		<div class="title">
			新增策略
		</div>
		<div class="content">
			<div>止盈：<input type="text" maxlength="3" id="lossWord" /><span>止盈范围10-500</span></div>
			<div>止损：<input type="text" maxlength="2" id="downWord" /><span>止损范围10-50</span></div>
		</div>
		<div class="Agreement">
			<p class="choose">
                <input type="checkbox" id="label">
                <label for="label">&nbsp;&nbsp;我已阅读并同意<a href="javascript:;" onclick="handanxieyi()">《策略协议》</a></label>
            </p>
		</div>
		<div class="modify_bottom">
			<span onclick="CallSingleCancel()">取消</span>
			<span onclick="handan(this)">确定</span>
		</div>
	</div>
	<!-- 底部撑块 -->
	<div id="j_bottom"></div>
	@include('mobile.footer')
<style>
	/*底部行情应用样式*/
	footer ul li:nth-child(1) a {
		color: #3B9CE0;
	}
	footer ul li:nth-child(1) a i {
		display: block;
        background: url("{{URL::asset('mobile/image/hq_icond.png') }}") no-repeat center/cover;
	}
	.ui-mobile, .ui-mobile body{
		background: #171922;
	}
</style>
@include('mobile.msg');
<script>
	function handanxieyi(){
		window.location.href = callorder;
	}

</script>
</body>
</html>
